﻿@{
    ViewBag.Title = "_LayuiTable";
    Layout = "~/Views/Shared/_LayuiMain.cshtml";
}
<script>
    var table;
    function getQueryWhere() {
        var j = formSerializeJson("form");
        return j;
    }
    function tableReload() {
        //执行重载
        table.reload('mainTable', {
            page: {
                curr: 1 //重新从第 1 页开始
            }
            , where: getQueryWhere()
            ,contentType: 'application/json'
        });
    }
    addLayuiApp('table');
    addLayuiUseEvent(function () {
        table = layui.table;
    });
    function tableRender(option) {
        if (option.method == undefined) {
            option.method = "post";
        }
        if (option.elem == undefined) {
            option.elem = '#mainTable';
        }
        if (option.cellMinWidth == undefined) {
            option.cellMinWidth = 120;
        }
        if (option.page == undefined) {
            option.page = true;
        }
        if (option.height == undefined) {
            option.height = 'full-200';
        }
        //option.contentType = 'application/json';
        //option.parseData = function (res) { //res 即为原始返回的数据
        //    console.log(res);
        //    return res;
        //}
        //height: 'full-200'
        table.render(option);
    }
</script>
@RenderBody()